import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import { getHosDetail, getDepartment } from '@/api/hosDetail/index'
import type { departmentType } from '@/stores/modules/index'
import type { departTYPE } from '@/api/hosDetail/type'

export const useDetailStore = defineStore('detail', {
  state: () => {
    return {
      //医院详情的数据
      hosDetail: {} as any,
      department: [] as departTYPE
    }
  },
  actions: {
    //获取医院详情的方法
    async getDetail(hoscode: string) {
      let result: any = await getHosDetail(hoscode)
      if (result.code == 200) {
          this.hosDetail = result.data
      }
      },
      // 获取科室的方法
      async getDep(hoscode:string) { 
          let result = await getDepartment(hoscode)
          if (result.code == 200) { 
              this.department = result.data
          }
      }
  },
  getters: {}
})